<%@page import="Data.PayType"%>
<%@page import="Data.Member"%>
<%@page import="Data.Event"%>
<%@page import="Data.EnrollEvent"%>
<%@page import="java.util.ArrayList"%>
<section id="content" class="gray-area">
    <div class="container car-detail-page">
        <div class="row">
            <div id="main" class="col-md-9">
                <div class="tab-container">
                    <ul class="tabs">
                        <li class="active">
                            <a  data-toggle="tab">History EnrollEvent</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div style="min-height: 500px; " class="tab-pane fade in active" id="car-details">
                            <form action="" method="post" name="frm" id="frm">

                                <hr />
                                <table width="100%" border="1" style="text-align: center" cellspacing="0" cellpadding="4" id="mytable">
                                    <tr>
                                        <th style="text-align: center"  scope="col">STT</th>
                                        <!--th scope="col"><input name="cb-sanphamCheckall" type="checkbox" value="" /></th>-->
                                        <th style="text-align: center"  scope="col">Event</th>

                                        <th style="text-align: center" scope="col">Date Register</th>
                                        <th style="text-align: center"  scope="col">Date Payment</th>
                                        <th style="text-align: center" scope="col">Payment Type</th>
                                        <th style="text-align: center"  scope="col">IsPayment</th>
                                        
                                        <!--<th style="text-align: center"  scope="col">Actions</th>-->
                                    </tr>
                                    <%
                                        Member m = new Member();
                                        ArrayList<Member> mb = m.MselectById(Integer.parseInt(request.getParameter("MemID")));
                                        for (int u = 0; u < mb.size(); u++) {
                                            Member ma = mb.get(u);
                                            //out.print("<td>" + ma.getUsername() + "</td>");

                                            EnrollEvent ct = new EnrollEvent();
                                            ArrayList<EnrollEvent> p = ct.SselectByMemID(ma.getMemberID());
                                            int k = 1;
                                            if (p.size() > 0) {
                                                for (int i = 0; i < p.size(); i++) {
                                                    EnrollEvent pay = p.get(i);
                                                    out.print("<tr>");
                                                    out.print("<td>" + k++ + "</td>");
                                                    // out.print("<td><input name='' type='checkbox' value='' /></td>");
                                                    Event ev = new Event();
                                                    ArrayList<Event> lsEvent = ev.ESelectByID(pay.getEventID());
                                                    for (int e = 0; e < lsEvent.size(); e++) {
                                                        Event me = lsEvent.get(e);
                                                        out.print("<td>" + me.getEventName() + "</td>");
                                                    }


                                                    out.print("<td>" + pay.getDateReg() + "</td>");
                                                    out.print("<td>");
                                                    if (pay.getDatePay().compareTo("1900-01-01") != 0) {
                                                        out.print(pay.getDatePay());
                                                    } else {
                                                        out.print("Unpaid");
                                                    }
                                                    out.print("</td>");
                                                    PayType pt = new PayType();
                                                    ArrayList<PayType> lsPt = pt.PselectById(pay.getPayID());
                                                    for (int pa = 0; pa < lsPt.size(); pa++) {
                                                        PayType mp = lsPt.get(pa);
                                                        out.print("<td>" + mp.getPayName() + "</td>");
                                                    }
                                                    if (pay.getIspayment() == 1) {
                                                        out.print("<td><img src='../admin/image/check.png' alt='check' /></td>");
                                                    } else {
                                                        out.print("<td><img src='../admin/image/No_check.png' alt='no_check' /></td>");
                                                    }

                                                    
                                                   // out.print("<td><span class='xoa'><a href='index.jsp?page=addEnrollevent&EenrolleventID=" + pay.getEnrollEventID() + "'><img src='../admin/image/editBtn.gif' alt='editBtn'  /></a>&nbsp;</span></td>");
                                                    out.print("</tr>");
                                                }

                                            }
                                        }
                                    %>



                                </table>
                                <div class="pages"></div>
                            </form>                            
                        </div>
                    </div>
                </div>
            </div>
            <jsp:include page="menu-right.jsp" />
        </div>
    </div>
</section>